import json

data = []
data.append({
    "name": "小明",
    "height": "170",
    "age": "18"
})
data.append({
    "name": "小红",
    "height": "165",
    "age": "20"
})


# 把python类型的数据以json格式储存到文件中
# 构建要写入文件对象
with open('./file/test2.json','w',encoding='utf-8')as fp:
    # 把python类型的数据以json格式储存到文件中
    json.dump(data,fp,ensure_ascii=False)